<!--
 * @Description: 描述
 * @Author: liym
 * @Date: 2025-05-08 20:14:38
 * @LastEditors: liym
 * @LastEditTime: 2025-06-16 21:06:52
-->
<template>
  <view class="admin-index">
    <uni-section title="商家后台" type="line">
      <template v-slot:right>
        <uni-icons class="user-icon" type="shop" size="30" color="#1aad19"></uni-icons>
        <Logout />
      </template>
    </uni-section>
	<view class="admin-menus">
		<button type="primary" @click="showAddModal"  class="admin-menu button-add">新增订单</button>
		<button class="admin-menu" @click="navigateTo('/pages/admin/profile')">个人资料</button>
		<button @click="navigateTo('/pages/admin/orders')" class="admin-menu">订单管理</button>
		<button @click="navigateTo('/pages/admin/agents')" class="admin-menu">代理管理</button>
		<button @click="navigateTo('/pages/admin/statistics')" class="admin-menu">统计报表</button>
	</view>
    
  </view>
</template>

<script>
import { adminRedirectionMixin } from '@/common/commonMixins.js';
import Logout from '@/components/logout.vue';
// console.log(adminRedirectionMixin)
export default {
  mixins: [adminRedirectionMixin],
  components: {
    Logout
  },
  methods: {
    navigateTo(url) {
		console.log("跳转页面",url)
     // uni.navigateTo({ url });
	 uni.navigateTo({
	     url: url,
	     success() {
	         console.log('跳转成功');
	     },
	     fail(err) {
	         console.log('跳转失败:', err);
	     }
	 });
	// uni.switchTab({ url: url });	
    },
    showAddModal () {
      // this.addModalVisible = true;
      // this.newOrder = {
      //   id: '',
      //   amount: '',
      //   createTime: '',
      //   agentName: ''
      // };
      uni.setStorageSync('order', null);
      uni.navigateTo({
        url: '/pages/admin/orderInfo'
      });
    }
  }
};
</script>

<style scoped lang="scss">
.user-icon {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10rpx;
}

.admin-menus {
	padding: 20rpx;
}

.admin-menu {
	margin-bottom: 20rpx;
}

.button-add {
	
}
</style>